﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AirlineSystemApp
{
    public partial class PrintRefundTicket : Form
    {
        public String strPnrNo, strName;
        public Decimal dRefundAmt;
        public PrintRefundTicket()
        {
            InitializeComponent();
        }

        private void PrintRefundTicket_Load(object sender, EventArgs e)
        {
            rtbRefundReceipt.BackColor = Color.White;
            rtbRefundReceipt.Text = "                                           HORIZON AIRWAYS                        ";
            rtbRefundReceipt.Text +=Environment .NewLine + "                                                 Refund Receipt";
            rtbRefundReceipt.Text += Environment .NewLine + "----------------------------------------------------------------------------------------------------------------";
            rtbRefundReceipt.Text += Environment .NewLine + "                                                                                                       Date:" +DateTime . Today.ToShortDateString ();
            rtbRefundReceipt.Text += Environment .NewLine + Environment .NewLine + "PNR No. : " + strPnrNo + Environment .NewLine + Environment .NewLine + "Passenger Name: " + strName;
            rtbRefundReceipt.Text += Environment .NewLine + Environment .NewLine + "Refund Amount (U.S. $): " + dRefundAmt;
            rtbRefundReceipt.Text += Environment .NewLine + Environment .NewLine + "                                                                                  ---------------------";
            rtbRefundReceipt.Text += Environment .NewLine + "                                                                                               Signature";
        }

        private void cmdPrint_Click(object sender, EventArgs e)
        {
            prndlgPrintRefundReceipt.Document = prndocPrintRefundReceipt;
            DialogResult result= prndlgPrintRefundReceipt.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
                prndocPrintRefundReceipt.Print();
            
        }

        private void prndocPrintRefundReceipt_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            //e.Graphics.DrawString(rtbRefundReceipt.Text, new Font("MS Sans Seri", 12, FontStyle.Regular), Brushes.Black, 150, 125);
            e.Graphics.DrawString(rtbRefundReceipt.Text, new Font("Times New Roman", 12, FontStyle.Regular), Brushes.Black, 150, 125);
        }

        private void cmdClose_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
